package org.example.chapter1;

import rx.Completable;
import rx.CompletableSubscriber;
import rx.Subscription;

public class Demo1_3_5 {
    public static void main(String[] args) {
        Completable.error(new Throwable("Completeable error"))
                .subscribe(new CompletableSubscriber() {
                    @Override
                    public void onCompleted() {
                        System.err.println("onCompleted");
                    }

                    @Override
                    public void onError(Throwable throwable) {
                        System.err.println("onError");
                    }

                    @Override
                    public void onSubscribe(Subscription subscription) {

                    }
                });
        Completable.complete().subscribe(new CompletableSubscriber() {
            @Override
            public void onCompleted() {
                System.err.println("OnCompleted");
            }

            @Override
            public void onError(Throwable throwable) {
                System.err.println("onError");
            }

            @Override
            public void onSubscribe(Subscription subscription) {
                System.err.println("onSubscribe");
            }
        });
    }
}
